#ifndef USEROPERATIONS_H
#define USEROPERATIONS_H
#include <iostream>
#include <fstream>
#include <string>
#include <memory>
#include <vector>
using namespace std;




// 用户类
class User {
public:
    string username;
    string password;
    User(      string   u,       string   p);
};



// 用户操作接口
class IUserOperations {
public:
    virtual bool readTxt() = 0;
    virtual bool registerUser(User   user) = 0;
    virtual bool loginUser( string   username,       string   password) = 0;
    virtual ~IUserOperations() = default;
};

// 实际用户操作类
class UserOperations : public IUserOperations {
public:
    vector<User> users; 
    bool readTxt() override;
    bool ifUser(string userName);
    bool registerUser(      User   user) override;
    bool loginUser(      string   username,       string   password) override;
};

// 代理类
class UserOperationsProxy  {
public:
    User *currentUser;
    UserOperations  userOps;
    UserOperationsProxy();
    bool registerUser(      User   user) ;
    bool ifUser(string userName) ;//判断存在
    bool loginUser(string   username,       string   password);

};

#endif // USEROPERATIONS_H
